package com.acme.bankapp.domine.bank;

// define class body
public class SavingAccount extends AbstractAccount {

    public SavingAccount(final int id, final double amount) {
        super(id, amount);
    }

    public int withdraw(final double amount) {
        if(getBalance() >= amount){
            setBalance(getBalance() - amount);
            return 0;
        }
        else {
            System.out.println("Error SavingAccount: balance < amount");
            return -1;
        }
    }

    @Override
    public double maximumAmountToWithdraw() {
        return getBalance();
    }
}
